package com.wy.powerbuilder.service.impl.hxl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wy.powerbuilder.entity.hxl.PageEntity;
import com.wy.powerbuilder.entity.hxl.carcontract;
import com.wy.powerbuilder.entity.hxl.carseat;
import com.wy.powerbuilder.mapper.hxl.carseatMapperAll;
import com.wy.powerbuilder.service.hxl.carseatAllService;
;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class carseatAllServiceImpl implements carseatAllService {
    @Autowired
    private carseatMapperAll carseatall;

    @Override
    public int singledelete(Integer cs_id) {
        return carseatall.singledelete(cs_id);
    }

    @Override
    public int singledeleteall(String cs_id) {
        return carseatall.singledeleteall(cs_id);
    }

    @Override
    public int singleupdate(carseat cars) {
        return carseatall.singleupdate(cars);
    }

    @Override
    public carseat singleselectidall(int cs_id) {
        return carseatall.singleselectidall(cs_id);
    }

    @Override
    public List<carseat> singles(String cs_state) {
        return carseatall.singles(cs_state);
    }

    @Override
    public PageInfo<carseat> selByPage(Integer pageNum, Integer pageSize, String cs_state) {
        if(pageNum==null){
            pageNum = 1;//默认查询第一页
        }
        //对查询的信息进行分页
        //第一个参数当前页码,第二个每页的条数
        PageHelper.startPage(pageNum,pageSize) ; //使用分页插件开始分页
        //查询我们将要分页的信息
        List<carseat> students = carseatall.singles(cs_state);
        //将查询的学生信息放到分页对象中去
        PageInfo<carseat> pageInfo = new PageInfo<>(students);
        return pageInfo;
    }

}
